package com.opgea.tutor.domain.entities;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

/**
 * Entity implementation class for Entity: Student
 * 
 */
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorValue(value = "S")
public class Student extends Person implements Serializable {

    private static final long serialVersionUID = 1L;

    private String schoolName;
    private String standard;
    private String educationMedium;
    private String description;

    @OneToMany(fetch = FetchType.LAZY)
    private Collection<StudentDocument> documents = new ArrayList<StudentDocument>();

    @OneToOne
    private Login login;

    public Student() {
	super();
    }

    public void addDocument(StudentDocument document) {
	if (documents != null) {
	    documents.add(document);
	} else {
	    documents = new ArrayList<StudentDocument>();
	    documents.add(document);
	}
    }

    public Login getLogin() {
	return login;
    }

    public void setLogin(Login login) {
	this.login = login;
    }

    public String getSchoolName() {
	return schoolName;
    }

    public void setSchoolName(String schoolName) {
	this.schoolName = schoolName;
    }

    public String getEducationMedium() {
	return educationMedium;
    }

    public void setEducationMedium(String educationMedium) {
	this.educationMedium = educationMedium;
    }

    public String getStandard() {
	return standard;
    }

    public void setStandard(String standard) {
	this.standard = standard;
    }

    public String getDescription() {
	return description;
    }

    public void setDescription(String description) {
	this.description = description;
    }

    public Collection<StudentDocument> getDocuments() {
	return documents;
    }

    public void setDocuments(Collection<StudentDocument> documents) {
	this.documents = documents;
    }

    @Override
    public String toString() {
	return "Student [educationMedium=" + educationMedium + ", standard="
		+ standard + ", description=" + description + ", login="
		+ login + "]";
    }

}
